//package io.netty.epoll;
//
//import io.netty.bootstrap.ServerBootstrap;
//import io.netty.buffer.PooledByteBufAllocator;
//import io.netty.channel.Channel;
//import io.netty.channel.ChannelOption;
//import io.netty.channel.EventLoopGroup;
//import io.netty.channel.epoll.EpollEventLoopGroup;
//import io.netty.channel.epoll.EpollServerSocketChannel;
//import io.netty.handler.ssl.SslContext;
//import io.netty.handler.ssl.SslContextBuilder;
//import io.netty.handler.ssl.util.SelfSignedCertificate;
//
///**
// * An HTTP server that sends back the content of the received HTTP request in a pretty plaintext
// * form.
// */
//public final class HttpHelloWorldServer {
//
//    static final boolean SSL = System.getProperty("ssl") != null;
//    static final int PORT = Integer.parseInt(System.getProperty("port", SSL ? "8443" : "8080"));
//
//    public static void main(String[] args) throws Exception {
//        // Configure SSL.
//        final SslContext sslCtx;
//        if (SSL) {
//            SelfSignedCertificate ssc = new SelfSignedCertificate();
//            sslCtx = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()).build();
//        } else {
//            sslCtx = null;
//        }
//
//        // Configure the server.
//        EventLoopGroup bossGroup = new EpollEventLoopGroup(1);
//        EventLoopGroup workerGroup = new EpollEventLoopGroup();
//
//        try {
//            ServerBootstrap b = new ServerBootstrap();
//            b.channel(EpollServerSocketChannel.class);
//            b.option(ChannelOption.SO_BACKLOG, 1024);
//            b.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
//            b.group(bossGroup, workerGroup)
//                    // .handler(new LoggingHandler(LogLevel.INFO))
//                    .childHandler(new HttpHelloWorldServerInitializer(sslCtx));
//
//            Channel ch = b.bind(PORT).sync().channel();
//            /*
//             * System.err.println("Open your web browser and navigate to " + (SSL? "https" : "http")
//             * + "://127.0.0.1:" + PORT + '/');
//             */
//            ch.closeFuture().sync();
//        } finally {
//            bossGroup.shutdownGracefully();
//            workerGroup.shutdownGracefully();
//        }
//    }
//}
